package com.zggk.lzz.xxyd;

import android.app.Activity;

import com.alibaba.fastjson.JSON;
import com.zggk.lzz.api.MyApplication;
import com.zggk.lzz.api.Urls;
import com.zggk.lzz.callback.StringDialogCallback;
import com.zggk.lzz.mvp.BasePresenterImpl;
import com.lzy.okgo.OkGo;
import com.lzy.okgo.model.Response;

/**
 * MVPPlugin
 *  邮箱 784787081@qq.com
 */

public class XxydPresenter extends BasePresenterImpl<XxydContract.View> implements XxydContract.Presenter{
    @Override
    public void getData(Activity activity) {
        OkGo.<String>post(Urls.JAVASERVER3+"assets/file/findByFileIds")
                .params("token", "Bearer$" + MyApplication.spUtils.getString("Token",""))
                .params("data", "文件资料")
                .params("pageIndex", "0")
                .params("pageSize", "20")
                .params("sortField", "create_time")
                .params("sortOrder", "desc")
                .execute(new StringDialogCallback(activity) {
                    @Override
                    public void onSuccess(Response<String> response) {
                        XxydBean xxydBean = JSON.parseObject(response.body(),XxydBean.class);
                        if (mView == null)
                            return;
                        mView.getDatas(xxydBean.getData());
                    }
                });
    }
}
